const state = {
    //全局loading
    loadingGlobal: {
        loading: false,
        text: ''
    },

}
//同步操作
const mutations = {
    //打开全局loading
    openLoading: (state, text) => {
        state.loadingGlobal.loading = true;
        state.loadingGlobal.text = text;
    },
    //关闭全局loading
    closeLoading: (state) => {
        state.loadingGlobal.loading = false;
    },
}
//异步操作
const actions = {
    //打开全局loading
    openLoading({ commit }, text) {
        commit('openLoading', text)
    },
    //关闭全局loading
    closeLoading({ commit }) {
        commit('closeLoading')
    },

}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
